package user

import (
	"context"
	"github.com/jinzhu/copier"
	"go.uber.org/zap"
	"navi-mumbai/app/rpc/usercenter/pb"

	"navi-mumbai/app/api/business/internal/svc"
	"navi-mumbai/app/api/business/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type DeleteUserPayAccountLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewDeleteUserPayAccountLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteUserPayAccountLogic {
	return &DeleteUserPayAccountLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *DeleteUserPayAccountLogic) DeleteUserPayAccount(req *types.DeleteUserPayAccountReq) (resp *types.DeleteUserPayAccountResp, err error) {
	var in pb.DeleteUserPayAccountReq
	_ = copier.Copy(&in, req)
	_, err = l.svcCtx.UcUserRpc.DeleteUserPayAccount(l.ctx, &in)
	if err != nil {
		l.Logger.Errorf("err == ", zap.Error(err))
		return nil, err
	}
	resp = &types.DeleteUserPayAccountResp{}
	return
}
